package data.account.attendee.travel;

import java.util.Scanner;

public class TravelData
{
	private String airline;
	public String airline() { return airline; }
	public void setAirline(String airline) { this.airline = airline; }
	
	private String arrivalDate;
	public String arrivalDate() { return arrivalDate; }
	public void setArrivalDate(String arrivalDate) { this.arrivalDate = arrivalDate; }
	
	private String arrivalTime;
	public String arrivalTime() { return arrivalTime; }
	public void setArrivalTime(String arrivalTime) { this.arrivalTime = arrivalTime; }
	
	private int cost;
	public int cost() { return cost; }
	public void setCost(int cost) { this.cost = cost; }
	
	public TravelData(String airline, String arrivalDate, String arrivalTime, int cost)
	{
		this.airline = airline;
		this.arrivalDate = arrivalDate;
		this.arrivalTime = arrivalTime;
		this.cost = cost;
	}
	
	public TravelData(String data)
	{
		Scanner dataScanner = new Scanner(data);
		dataScanner.useDelimiter("%");
		System.out.println("Travel string: [" + data + "]");
		airline = dataScanner.next();
		arrivalDate = dataScanner.next();
		arrivalTime = dataScanner.next();
		cost = Integer.parseInt(dataScanner.next());
	}
	
	public String toData()
	{
		return  airline + "%" +
				arrivalDate + "%" +
				arrivalTime + "%" + 
				cost;
	}
}